package com.mf.controller;

import com.mf.entity.Customer;
import com.mf.entity.CustomerWarehouse;
import com.mf.service.ICustomerService;
import com.mf.service.impl.CustomerServiceImpl;
import com.mf.utils.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author mf
 * @since 2024-04-26
 */
@RestController
@RequestMapping("/customer")
@Tag(name = "客户相关")
public class CustomerController {
    @Resource
    private ICustomerService customerService;

    @Operation(summary = "添加客户")
    @PostMapping("/add")
    public Result<Boolean> add(@RequestBody Customer customer) {
        return Result.success(customerService.save(customer));
    }


    @Operation(summary = "获取客户仓库存放位置")
    @GetMapping("/getCustomerByWarehouseList/{area}")
    public Result<List<CustomerWarehouse>> getCustomerByWarehouseList(@PathVariable("area") String area) {
        return Result.success(customerService.getCustomerByWarehouseList(area));
    }
}
